﻿using System;
using System.Collections.Generic;
using System.Text;
using Tunynet.QingdaoCustoms.Data.Utils;
using Tunynet.QingdaoCustoms.Common;

namespace ChinaCustoms.Qingdao.Workflow.Supports
{
    public class WorkflowTemplate
    {
        //需要实现的方法

        //1.添加 2.删除 3.更新 4.获取单条 5.获取列表 6.根据ApplictionID获取列表
        /// <summary>
        /// 创建工作流模板
        /// </summary>
        public int CreateWorkflowTemplate(WorkflowTemplateInfo workflowTemplateInfo)
        {
            WorkflowTemplateInfo templateInfo= TemplateDataProvider.Instance().CreateUpdateWorkflowTemplate(workflowTemplateInfo, DataProviderAction.Create);
            return templateInfo.WorkflowTemplateID;
        }

        /// <summary>
        /// 更新工作流模板
        /// </summary>
        public void UpdateWorkflowTemplate(WorkflowTemplateInfo workflowTemplateInfo)
        {
            TemplateDataProvider.Instance().CreateUpdateWorkflowTemplate(workflowTemplateInfo, DataProviderAction.Update);
        }


        /// <summary>
        /// 删除工作流模板
        /// </summary>
        public void DeleteWorkflowTemplate(int workflowTemplateID)
        {
            TemplateDataProvider.Instance().DeleteWorkflowTemplate(workflowTemplateID);
        }

        /// <summary>
        /// 通过ApplictionID获取工作流模板
        /// </summary>
        public IList<WorkflowTemplateInfo> GetWorkflowTemplateByApplictionID(Guid ApplictionID)
        {
            throw new System.NotImplementedException();
        }

        /// <summary>
        /// 获取工作流模板集合
        /// </summary>
        /// <param name="query">工作流模板查询实体信息</param>
        /// <returns></returns>
        public IList<WorkflowTemplateInfo> GetWorkflowTemplates(WorkflowTemplateQuery query)
        {
            return TemplateDataProvider.Instance().GetWorkflowTemplates(query);
        }

        ///// <summary>
        ///// 获取
        ///// </summary>
        //public PagingDataSet<WorkflowTemplateInfo> GetWorkflowTemplateByApplictionID()
        //{
        //    throw new System.NotImplementedException();
        //}

        /// <summary>
        /// 获取工作流模板
        /// </summary>
        public WorkflowTemplateInfo GetWorkflowTemplate(int workflowTemplateID)
        {
            return TemplateDataProvider.Instance().GetWorkflowTemplate(workflowTemplateID);
        }

    }
}
